<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div class="show">
            <div class="tip">{{t0}}</div>
            <div class="tip">{{t1}}</div>
            <button ng-click="action(true)">解决</button>
            <button ng-click="action(false)">拒绝</button>
        </div>
    </div>

    <script>
        angular.module('app',[])
            .controller('cont',function ($scope,$q) {
                var defer = $q.defer();
                $scope.action = function (type) {
                    defer.notify(0);
                    type ? defer.resolve(1) : defer.reject(1);
                }
                var promise = defer.promise;
                promise.then(function (n) {
                    n++;
                    $scope.t1 = "已经处理完成：" + n;
                },function (n) {
                    n++;
                    $scope.t1 = "未完成原因：" + n;
                },function (n) {
                    n++;
                    $scope.t0 = "正在处理中：" + n;
                })

            })

    </script>
</body>
</html>